﻿using EkStudio.com.bean.xml.BillModule;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EkStudio.com.ui.unitbill.property
{
    public class BillUiModuleToProperty
    {
        

        private BillModuleItem parent = null;

        public BillUiModuleToProperty(BillModuleItem _bean)
        {
            this.parent = _bean;
            if(parent.BillModule.Advanced.DyBody == null)
            {
                parent.BillModule.Advanced.DyBody = new BillModuleDyMessage();
            }
        }

        public string Key
        {
            get
            {
                return this.parent.BillModule.Key;
            }

            set
            {
                this.parent.BillModule.Key = value;
                
            }
        }

        public string Caption
        {
            get
            {
                return parent.BillModule.Caption;
            }

            set
            {
                parent.BillModule.Caption = value;
            }
        }

        public string GroupList
        {
            get
            {
                return parent.BillModule.GroupList;
            }

            set
            {
                parent.BillModule.GroupList = value;
            }
        }

        public bool Archive
        {
            get
            {
                return parent.BillModule.Behavior.Archive;
            }

            set
            {
                parent.BillModule.Behavior.Archive = value;
            }
        }

        public bool Attachment
        {
            get
            {
                return parent.BillModule.Behavior.Attachment;
            }

            set
            {
                parent.BillModule.Behavior.Attachment = value;
            }
        }

        public bool Catalogue
        {
            get
            {
                return parent.BillModule.Behavior.Catalogue;
            }

            set
            {
                parent.BillModule.Behavior.Catalogue = value;
            }
        }

        public bool Reminder
        {
            get
            {
                return parent.BillModule.Behavior.Reminder;
            }

            set
            {
                parent.BillModule.Behavior.Reminder = value;
            }
        }

        public bool Tags
        {
            get
            {
                return parent.BillModule.Behavior.Tags;
            }

            set
            {
                parent.BillModule.Behavior.Tags = value;
            }
        }

        public bool Search
        {
            get
            {
                return parent.BillModule.Advanced.Search;
            }

            set
            {
                parent.BillModule.Advanced.Search = value;
            }
        }

        

        public string ModuleIcon
        {
            get
            {
                return parent.BillModule.Advanced.ModuleIcon;
            }

            set
            {
                parent.BillModule.Advanced.ModuleIcon = value;
            }
        }

        public string AttachList
        {
            get { return "[AttchList]"; }
            set { }
        }

        public string Creater
        {
            get
            {
                return parent.BillModule.Owner.Creater;
            }

            set
            {
                parent.BillModule.Owner.Creater = value;
            }
        }

        public string Created
        {
            get
            {
                return parent.BillModule.Owner.Created;
            }

            set
            {
                parent.BillModule.Owner.Created = value;
            }
        }

        public string LastMender
        {
            get
            {
                return parent.BillModule.Owner.LastMender;
            }

            set
            {
                parent.BillModule.Owner.LastMender = value;
            }
        }

        public string LastModified
        {
            get
            {
                return parent.BillModule.Owner.LastModified;
            }

            set
            {
                parent.BillModule.Owner.LastModified = value;
            }
        }

        public bool Compress
        {
            get { return parent.BillModule.Compress; }
            set { parent.BillModule.Compress = value; }
        }

        public string DataSource
        {
            get { return "[DataSource]"; }
            set { }
        }
        [Description("启用消息订阅功能")]
        public bool DyMsgEnable
        {
            get { return parent.BillModule.Advanced.DyMsgEnable; }
            set { parent.BillModule.Advanced.DyMsgEnable = value; }
        }
        [Description("订阅消息显示类型StWork:在我的工作中显示 StNews:在新闻中显示 StFile:在文档中显示 StMeet:在会议中显示")]
        public string DyMsgType
        {
            get { return (parent.BillModule.Advanced.DyBody == null ? "" : parent.BillModule.Advanced.DyBody.DyMsgType); }
            set
            {
                if(parent.BillModule.Advanced.DyBody == null)
                {
                    parent.BillModule.Advanced.DyBody = new BillModuleDyMessage();
                }
                parent.BillModule.Advanced.DyBody.DyMsgType = value;
            }
        }
        [Description("订阅消息的标题字段,显示在消息中的标题内容")]
        public string DyMsgTitle
        {
            get { return parent.BillModule.Advanced.DyBody == null ? "" : parent.BillModule.Advanced.DyBody.DyMsgTitle; }
            set
            {
                if (parent.BillModule.Advanced.DyBody == null)
                {
                    parent.BillModule.Advanced.DyBody = new BillModuleDyMessage();
                }
                parent.BillModule.Advanced.DyBody.DyMsgTitle = value;
            }
        }
        [Description("订阅消息中的正文")]
        public string DyMsgBody
        {
            get { return parent.BillModule.Advanced.DyBody == null ? "" : parent.BillModule.Advanced.DyBody.DyMsgBody; }
            set
            {
                if (parent.BillModule.Advanced.DyBody == null)
                {
                    parent.BillModule.Advanced.DyBody = new BillModuleDyMessage();
                }
                parent.BillModule.Advanced.DyBody.DyMsgBody = value;
            }
        }
        [Description("订阅消息接收人员权限类型,StField:指定字段为接收人字段内容为用户,多用户用逗号隔开, StGlobal:广播信息,StDepartment:部门消息,上级部门也会收到,StUserRole:指定角色逗号隔开<br>StUser:指定用户逗号隔开")]
        public string DyMsgUserType
        {
            get { return parent.BillModule.Advanced.DyBody == null ? "" : parent.BillModule.Advanced.DyBody.DyMsgUserType; }
            set
            {
                if (parent.BillModule.Advanced.DyBody == null)
                {
                    parent.BillModule.Advanced.DyBody = new BillModuleDyMessage();
                }
                parent.BillModule.Advanced.DyBody.DyMsgUserType = value;
            }
        }
        [Description("订阅消息中的权限参数")]
        public string DyMsgUser
        {
            get { return parent.BillModule.Advanced.DyBody != null ? parent.BillModule.Advanced.DyBody.DyMsgUser : ""; }
            set
            {
                if (parent.BillModule.Advanced.DyBody == null)
                {
                    parent.BillModule.Advanced.DyBody = new BillModuleDyMessage();
                }
                parent.BillModule.Advanced.DyBody.DyMsgUser = value;
            }
        }
    }
}
